package com.dayuanit.dy16.ebook.ebookweb.enums;

import com.dayuanit.dy16.ebook.ebookweb.exception.BizException;

public enum OrderStatusEnum {
    //1-待付款 2-已完成 3-已取消
    wait_pay(1, "待付款"),
    pay_success(2, "已完成"),
    cancel(3, "已取消");

    private int k;
    private String v;

    private OrderStatusEnum(int k, String v) {
        this.k = k;
        this.v = v;
    }

    public static OrderStatusEnum get(int k) {
        for (OrderStatusEnum en : OrderStatusEnum.values()) {
            if (en.getK() == k) {
                return en;
            }
        }

        throw new BizException("非法状态");
    }

    public String getV() {
        return v;
    }

    public int getK() {
        return k;
    }
}
